package com.example.baiduai.service;

import com.baidu.aip.imageclassify.AipImageClassify;
import com.example.baiduai.factory.AipFactory;
import org.json.JSONObject;

import java.util.HashMap;

/**
 * @author wangyizhu
 * @version "1.8.0_131"
 * @email 2641956765@qq.com
 * @desc:
 * @Time 2022/09/23 14:37
 */
public class OcrService {
    /**
     * 货币识别
     * @param data
     * @return
     */
    public String currency(byte[] data) {
        // 传入可选参数调用接口
        HashMap<String, String> options = new HashMap<String, String>();
        // 参数为本地路径
        AipImageClassify client = AipFactory.getOcrInstance();
        JSONObject res = client.currency(data, options);
        return res.toString((2));
    }
    public  String animalDetect(byte[] data){
        // 传入可选参数调用接口
        HashMap<String, String> options = new HashMap<String, String>();
        // 参数为本地路径
        AipImageClassify client = AipFactory.getOcrInstance();
       JSONObject res = client.animalDetect(data, options);
        return res.toString((2));
    }


}
